package com.ns.attendance.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class LoadConfig {

	private static Properties prop = new Properties();
	
	static{
		InputStream is = null;
		File file = new File("conf.properties");
		try {
			is = new FileInputStream(file);
			prop.load(is);
			is.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 获取key对应的值
	 * 
	 * @Title:getValue
	 * @Description:TODO
	 * @param @param key
	 * @param @return
	 * @return String
	 * @throws
	 */
	public static String getValue(String key) {
		return prop.getProperty(key);
	}

	/**
	 * 批量获取属性值
	 * 
	 * @Title:loadConfig
	 * @Description:TODO
	 * @param @param params
	 * @param @return
	 * @return String[]
	 * @throws
	 */
	public static String[] loadConfig(String...params) {
		String[] properties = new String[params.length];
		for (int i = 0; i < params.length; i++) {
			properties[i] = LoadConfig.getValue(params[i]);
		}
		return properties;
	}

}
